package com.leetcode;

import java.util.Scanner;

/**
 * TODO
 *
 * @author lefly
 * @version 1.0
 * @classname No43
 * @description
 * @date 2021/2/5 下午3:12
 */
public class No43 {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String num1 = sc.next();
        String num2 = sc.next();
        String res = multiply(num1,num2);
        System.out.println(res);
    }

    public static String multiply(String num1, String num2) {
        if(num1 == "" || num2 == ""){
            return "";
        }
        int len1 = num1.length() - 1,len2 = num2.length() - 1;
        int[] temp = new int[len1 + len2 + 2];
        for(int i = len1;i >= 0;i--){
            int a = num1.charAt(i) - '0';
            for(int j = len2;j >= 0;j--){
                int b = num2.charAt(j) - '0';
                int sum = a * b + temp[i + j + 1];
                // 细节 上一位
                temp[i + j] += sum / 10;
                temp[i + j + 1] = sum % 10;
            }
        }
        int i = 0;
        // 细节二 i
        while(i < temp.length - 1 && temp[i] == 0){
            i++;
        }
        StringBuilder str = new StringBuilder();
        while(i < temp.length){
            str.append(temp[i++]);
        }
        return str.toString();
    }

}
